

def func(list1):
    list1.append(10)


my_list = [1, 2]
func(my_list)
print(my_list)  # [1, 2, 10]


def func(list1):
    list1[0] = 10


my_list = [1, 2]
func(my_list)
print(my_list)  # [10, 2]


def func(list1):
    list1 = [2, 1]


my_list = [1, 2]
func(my_list)
print(my_list)  # [1, 2]


def func(list1):
    list1 += [1, 2]  # 对列表使用 += 相当于 list.extend(seq)


my_list = ['a', 'b']
func(my_list)
print(my_list)  # ['a', 'b', 1, 2]
